/**
 * Created by Administrator on 2016/4/1.
 */


(function ($){

    getWH();
    indexnavbind();
    //bindMainDetails();
    //动态获取页面和屏幕宽高
    $(window).resize(function () {
        if(getPageSize()[0]<480){
            window.resizeTo(document.body.clientWidth,480);
        }else{
            getWH();
        }
    })
    /*应用angularjs*/
    /*配置angular*/
    var app=angular.module("myapps",[]);
    /*配置控制器*/
    app.controller("getmsginfo",function($scope,$http){
        $scope.getmsg=function (){
            $http.get("/pages/mainlist.do").success(function (data){
                console.log(data);
                var myarr=[];
                for(var i = 0;i<data.length;i++){
                    var mydata = data[i].shop_address.split("-",1);
                    myarr.push(mydata);
                    data[i].shop_address=myarr[i];
                }

                $scope.mymsg=data;
                //console.log(mylist);
            })
        };
        $scope.getthsinfo= function (s) {
            //jQuery(this).children("p").html();
            console.log(s);
            //window.location.href="pages/mainDetails.html?title="+s;
            window.location.href="pages/mainDetails.html";
            //$http.post("pages/mainDetails.html",{title:s}).success(function (data){
            //
            //});
        }
    });

})(jQuery);


function getWH(){
    var screenWidth = getPageSize()[2];
    var screeenHeight = getPageSize()[3];
    var pageWidth = getPageSize()[0];
    var pageHeight = getPageSize()[1];

//    设置每个模块的高度
    $("#myheader").css("height",screenWidth *.13+"px");
    $("#myheader .map").css("line-height",screenWidth *.13+"px");
    $("#myheader #page-title").css({"line-height":screenWidth *.13+"px","padding":"0"});
    $(".header-title-container").css("height",screenWidth *.3+"px");
    $(".my-logo").css({
        "height":$(".my-logo").css("width")
    });
    $(".main-container .content-list .content").css("height", screenWidth*.5);
}

function bindMainDetails(){
    $(".content-list .content").on("tap", function () {
        //alert($(".content-title p").html());
        //$.mobile.changePage({
        //    url:"pages/mainDetails.html" ,
        //    type:"post" ,
        //    data: $(".content-title p").html()
        //    //data: $("form#search").serialize()
        //});
        window.location.href="pages/mainDetails.html";
        //$.mobile.changePage("pages/mainDetails.html", "slideup");
    });
}


